﻿
        <!-- /. NAV SIDE  -->
        <div id="page-wrapper">
            <div id="page-inner">
                <div class="panel panel-default">
                 
       <div class="panel-body">
                            
            <form role="form" method="post" action="">
                管理添加
                <br />
                        <div class="form-group has-success">
                            <label class="control-label" for="success" >用户名</label>
                            <input name="username" type="text" class="form-control username" id="success" style="width:500px;" />
                            <div>
                              <label class="control-label username_z " for="success" style="color:red;"></label>
                            </div>
                            <label class="control-label" for="success" >密码</label>
                              <input name="password" type="password" class="form-control password" id="success" style="width:500px;" />
                          <div>
                              <label class="control-label password_z " for="success" style="color:red;"></label>
                          </div>
                               <label class="control-label" for="success" >确认密码</label>
                              <input name="password" type="password" class="form-control passwort" id="success" style="width:500px;" />
                              <div>
                              <label class="control-label passwort_z " for="success" style="color:red;"></label>
                            </div>
                              <div class="form-group has-warning">

                            <label class="control-label" for="warning">性别</label>
                            <select name="sex" >
                                <option value="0" >女</option>
                                <option value="1" >男</option>

                            </select>
                               <select name="role_id" class="">
                            <option value="0">顶级层</option>
                            <?php foreach($data as $v){?>
                            <option value="<?php echo $v['id']?>">
                            <?php echo $v['name']?>

                            </option>
                            <?php }?>       

                          </select>
                        </div>
                              <label class="control-label " for="success" >邮箱</label>
                              <input name="emil" type="text" class="form-control emil" id="success" style="width:500px;" />
                              <div>
                              <label class="control-label emil_z " for="success" style="color:red;"></label>
                              </div>
                               <label class="control-label" for="success" >手机号</label>
                              <input name="tel" type="tell" class="form-control tell" id="success" style="width:500px;" />
                              <div>
                              <label class="control-label tell_z " for="success" style="color:red;"></label>
                              </div>
                        </div>
                        
                        <div class="form-group has-error">
                           
                            <div class="form-group has-success" style="width:80">
                            <label  class="control-label age" for="success" style="width:80">年龄</label>
                            <input type="text" name="age" class="form-control" id="success" style="width:500px;" />
                             <div class="code">  
      <label  class="control-label" for="success">验证码</label>                                                                            
    <input type="text" class="form-control"  name="code" style="width:100px" />
    <img class="code" src="index.php?c=admin&a=code&admin=1" >

    </div>  
                                        </div>
                                        
                                      <input class="submit" type="submit" name="" value="提交">  
                                    </form>
                          </div>
<script type="text/javascript" src="jquery-2.2.3.min.js"></script>
<script type="text/javascript">
$(function(){

  
    $('.code').click(function(){

          var src=$(this).attr('src');

          src=src+'&'+Math.random()*10;

          $(this).attr('src',src);             
    });


$('.username').blur(function(){

      var user=$(this).val();
      var str =user;
      var reg=/^[A-za-z]\w{3,15}$/ ;
      var result = reg.exec(str);

  if(result==null){
     $('.username_z').text('您的输入不符合要求');
  }else{
    $('.username_z').attr('style','color:green');
    $('.username_z').text('ok');
  }

})


  $('.username').focus(function(){
    
   $('.username_z').text('请输入以英文字母为开头的3-16位的字符串');
  })



$('.emil').blur(function(){
      var emil=$(this).val();
      var str =emil;
      var reg= /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+(|QQ)|(126)|(163) )[-.]+[A-Za-z\d]{2,4}$/;
      var result = reg.exec(str);
      if(result==null){
     $('.emil_z').text('您的输入不符合要求');
  }else{
    $('.emil_z').attr('style','color:green');
    $('.emil_z').text('ok');
  }

})



$('.tell').blur(function(){
      var tell=$(this).val();
      var str =tell;
      var reg= /^1[3-8]\d{9}$/;
      var result = reg.exec(str);
      if(result==null){
     $('.tell_z').text('您的输入不符合要求');
  }else{
    $('.tell_z').attr('style','color:green');
    $('.tell_z').text('ok');
  }

})
$('.password').blur(function(){
      var password=$(this).val();
      var str =password;
      var reg= /^[a-zA-Z\d_]{6,14}$/
      var result = reg.exec(str);
      if(result==null){
     $('.password_z').text('您的输入不符合要求');
  }else{
    $('.password_z').attr('style','color:green');
    $('.password_z').text('ok');
  }

})
$('.passwort').keyup(function(){
  // alert(444)

  var pswt = $(this).val();
  var pswd = $('.password').val();
  // alert(psw);

  
  if(pswt==pswd){

    $('.passwort_z').attr('style','color:green');
    
    $('.passwort_z').text('通过');
  
}else{
    $('.passwort_z').text('两次输入的密码不一样');
  } 

})

$('.submit').click(function(){
      
       var password=$(password).text();

       var username=$(username).text();
       var emil=$(emil).text();
       var sex=$(sex).text();
     
                    if(password&&username&&emil&&sex==0){  
                        return false ;  
                    }else{  
                        return true;  
                    }
}  
})







</script>